package com.knight.interview.weiyinzhifu;

import java.io.FileReader;
import java.io.FileWriter;

public class FileReaderAndWriter {

	
	public static void main(String[] args)throws Exception {
		FileReader fr = new FileReader("d://source.txt");
		FileWriter fw = new FileWriter("d://target.txt");
		char ch[] = new char[1024];
		int length = fr.read(ch);
		while(length != -1){
			fw.write(ch);
			length = fr.read(ch);
		}
		
		if(null != fr){
			fr.close();
		}
		if(null != fw){
			fw.close();
		}
	}

}
